var express = require('express');
var home = require('./home/index');
var product = require('./product/index');
var shop = require('./shop/index');
var pay = require('./pay/index');
var order = require('./order/index');
var Login = require('./login/login');
var share = require('./share/index');
var invitation = require('./invitation/index');

module.exports = function(app){
    //首页相关
    app.get('/home/:shopId',home.index);
    //商品相关
    app.get('/product/:id',product.detail);
    app.get('/search/:shopId',product.search);
    //店铺相关
    app.get('/shop',shop.render);
    //付款相关--信息
    app.get('/pay',pay.orderConfirm);//订单确认
    app.get('/payment',pay.payment);//支付方式选择
  //付款相关--购物车
  app.get('/cart',pay.cart);//购物车
  app.post('/cart',pay.addToCart);
  app.post('/delCart',pay.delCart);
  app.post('/modCartCount',pay.modCartCount);
  //付款相关--信息
  app.get('/confirm',pay.orderConfirm);//订单确认
  app.post('/createOrder',pay.createOrder, pay.payment);//提交订单
  app.get('/payment',pay.payment);//支付方式选择
  //付款相关--地址
  app.post('/addAddress',pay.addAddress);
  app.post('/editAddress',pay.modAddress);
  app.post('/delAddress',pay.delAddress);

    //登录相关
    app.get('/login',Login.login);
    app.post('/login/withoutLoginCodeSend',Login.withoutLoginCodeSend);
    app.post('/login/doLogin',Login.doLogin);
    app.post('/login/register',Login.register);
    app.post('/login/resetPassword',Login.resetPassword);
    app.get('/login/wxLogin',Login.wxLogin);
    app.get('/login/wxLoginJump',Login.wxLoginJump);
    app.get('/sessionLogin',Login.sessionLogin);
    //登录过渡页
    app.get('/login/loginTransit',Login.loginTransit);

    //支付相关
    app.get('/pay/return',order.waitPayReturn);
    app.get('/check/return',order.getOrderStatus);
    app.post('/order/pay',order.confirmPay);
    app.get('/pay/success',order.paymentSuccess);
    app.post('/getWxPubSign',order.getWxPubSign);
    app.post('/pay/wxsuccess',order.setPayInfoWx);

    //订单相关
    app.get('/order/:orderId',order.detail);//订单详情
    app.get('/express',order.express);//物流信息
    app.get('/orders',order.orders);//购买记录
    app.post('/deleteOrder/:orderId',order.deleteOrder);
    app.post('/editOrder/:orderId',order.editOrder);

    //晒单
    app.get('/share/:orderId',share.share);

  //app跳转需要页面
  app.get('/invitation',invitation.invitation);
  app.get('/deposit',invitation.deposit);
  app.get('/income',invitation.income);
  app.get('/level',invitation.level);
  app.get('/team',invitation.team);



} ;
